package cn.semcorp.zhuhaizj.quartzConfig;

import cn.semcorp.zhuhaizj.quartzJob.TobeLoginJob;
import cn.semcorp.zhuhaizj.quartzJob.TobePlanJob;
import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QuartzLoginConfiguration {

    @Bean
    public JobDetail showLoginJob(){
        return JobBuilder.newJob(TobeLoginJob.class)
                .withIdentity("tobeLoginJob")
                .storeDurably()
                .build();
    }

    @Bean
    public Trigger showLoginTrigger(){
        CronScheduleBuilder cron =
            CronScheduleBuilder.cronSchedule("0 */30 * * * ? *");
        return TriggerBuilder.newTrigger()
                .withSchedule(cron)
                .withIdentity("showLoginTrigger")
                .forJob(showLoginJob())
                .build();
    }
}
